Skip to content
  • 0 Votes
    3 Posts
    2k Views
    zareenZ
    Solution (A) The formula to calculate the execution time : Execution Time = IC  CPI  T IC for Load / Store Instructions IC for ALU instructions IC for Control instructions = Total Instructions  Ratio of Load / Store Instructions = 200  0.35 = 70 instructions = Total Instructions  Ratio of ALU Instructions = 200  0.55 = 110 instructions = Total Instructions  Ratio of Control Instructions = 200  0.10 = 20 instructions Now, we will calculate the total clock cycles required to execute each type of instructions Total Clock Cycles for Load / Store Total Clock Cycles for ALU Total Clock Cycles for Control = IC for Load / Store  CPI for Load / Store = 70  2.5 = 175 clock cycles = IC for ALU  CPI for ALU = 110  1.25 = 137.5 clock cycles = IC for control  CPI for control = 20  3 = 60 clock cycles Time required (in seconds) for each clock cycle (T)=1/CPU frequency 1 / 500  106 = 0.002  10−6 seconds = 210−9 seconds Now finally, we will calculate the execution time Execution Time (ET ) = Total Clock Cycles  1/ CPU Frequency = (175 + 137.5 + 60)  (1/ 500  106 ) seconds = 372.5210−9seconds 1/500106 =210−9seconds = 745  10−9 seconds = 745 nanoseconds Solution (B) If decrease the average CPI for ALU by 20%, the new average CPI New CPI for ALU = 1.25  (100−20)/100 = 1.25  0.8 = 1 CPI If average CPI for Load / Store instruction is increased by 10%, new average CPI New CPI for Load / Store = 2.5  (100 +10)/100 = 2.5  1.1 = 2.75 CPI Hence, new execution time will be ExecutionTime(E.T) = (702.75+1101+203)x(1/500106)seconds = (192.5+110+60)/(5108)seconds = 362.5  2  10−9 seconds = 725  10−9 seconds = 725 nanoseconds Q. 2 Solution: Solution A (0-Address Code) PUSH B PUSH C ADD ; gives B+C PUSH A MUL ; gives A(B+C) PUSH 2 PUSH A MUL ; gives 2A PUSH C MUL ; gives 2AC PUSH B DIV ; gives 2AC/B SUB ; gives A(B+C) - 2AC/B PUSH C PUSH C MUL ; gives C2 ADD ; gives POP D A(B+C) - 2AC/B + C2 Solution A (1-Address Code) LDA C MULA C STA X LDA A MULA C MULA 2 ; loads the value stored at memory location C in Accumulator ; gives C2 ; stores C2 at memory location X ; loads the value stored at memory location A in Accumulator ; gives AC ; gives 2AC DIVA B ADDA X STA Y LDA B ADDA C MULA A SUB Y STA D ; gives 2AC/B ; adding 2AC/B with C2 stored in X gives 2AC/B + C2 ; stores 2AC/B + C2 at memory location Y ; loads the value stored at memory location B in Accumulator ; gives (B+C) ; gives A(B+C) ; subtracts 2AC/B + C2 from A(B+C) ; stores the result at memory location D Fall 2019_CS501_1_SOL.pdf
  • 0 Votes
    4 Posts
    1k Views
    zaasmiZ
    CS609 Assignment 1 Solution Idea!.. #include<BIOS.H> #include<DOS.H> char st1[80] ={"Virtual University of Pakistan$"}; char st2[80] ={"Washi Ali$"}; char st2[80] ={"Tufail$"}; void interrupt (*oldint65)( ); void interrupt newint65( ); void main() { oldint65 = getvect(0x65); setvect(0x65, newint65); keep(0, 1000); } void interrupt newint65( ) { switch (_AH) { case 0: _AH = 0x09; _DX = (unsigned int) st1; geninterrupt (0x21); break; case 1: _AH = 0x09; _DX = (unsigned int) st2; geninterrupt (0x21); break; case 2: _AH = 0x09; _DX = (unsigned int) st3; geninterrupt (0x21); break; } } }```
  • 0 Votes
    5 Posts
    1k Views
    zareenZ
    @zareen said in CS603 Assignment No. 1 Solution and Discussion: Question No. 1 [Marks = 5] The following UML activity diagram shows typical document routing system in offices, the clerk generates a draft document, after which it is forwarded to manager for review. The manager sends original document to “Accounts” section while the copy of the document with comments is moved towards “Records” section. Both (Accounts & Records) section forward the consolidated document to Head office for final approval, after which the document is approved and financial bill is generated. The diagram shows execution of two activities i.e. “Accounts” and “Records” in parallel. Redraw the above diagram by showing this parallelism using Joins/forks notation. Solution: [image: lEJK8fT.png]
  • 0 Votes
    3 Posts
    2k Views
    zareenZ
    [image: MQpxBtW.png] Intended Interaction: Objects Identifier system for blind users (a) Device Name (b) Features © Solved Problems Input Device(s) Mobile Camera The device must have the built in camera to capture the image of object. The image of object will be stored in the device for image processing. A blind or visually impaired people find difficulties to recognize different objects by just touching them (unless trained). This input device will solve their problem in recognizing these objects by capturing the image of the object through the camera of the device. Output Device(s) Synchronized Speaker A synchronized speaker that speaks out that which objects is this. The main feature of the speaker is to speak out the object name after recognition of the captured image or video. A blind or visually impaired people find difficulties to recognize different objects by just touching them. This device will solve their problem by speaking out the name of object by capturing the image. [image: YPXZaaa.png] OR: Goal and Sub-Goals: Looking at the operators an obvious one to resolve this goal is Update paragraph Which has the pre-condition ‘required page of the file should be opened and cursor at start of paragraph’. We therefore have a new sub-goal: move to paragraph. The pre-condition is ‘cursor anywhere in document’ (which we can meet) but we want the second paragraph so must initially be in the first. We set up a new sub-goal, move to start, with pre-condition ‘cursor anywhere in document’ and result ‘cursor at start of document’. We can then apply move to paragraph and finally update paragraph. We assume some knowledge here (that the second paragraph is the paragraph after the first one).
  • 0 Votes
    11 Posts
    3k Views
    zareenZ
    @zaasmi 3. Calculate the total float for each activity. Correct Solution Answer: [image: M9X6s5P.png] Identify the critical path. Answer: A+C+E+G = 3+2+5+6 = 16 A+D1+F+G = 3+0+3+6 = 12 B+D+F+G = 5+4+3+6 = 18 A+C+D2+F+G = 3+2+0+3+6 = 14 The longest path is and the duration is 18 days. So, the critical path is . Find the project completion time. Answer: The project completion time is 18 days.
  • 1 Votes
    9 Posts
    2k Views
    zareenZ
    @zareen said in CS502 Assignment No. 01 Solution and Discussion: Question No 02: (Marks: 10) You are required to calculate (Step by Step) the worst case time complexity T(n) of the algorithm designed in Question No. 01. Solution: Question No. 02: The step by stem analysis of the algorithm designed in question 1 is as follow, The time taken by each statement (step) is given as follows, Step 1: C1 // Execute only 1 time or Constant Time or O (1) Step 2: C2 // Execute only 1 time or Constant Time or O (1) Step 3: n -2 // Execute n -2 times Step 4: n -2 // Execute n -2 times Step 5: n – 2 // Execute n -2 times Step 6: C3 // Execute only 1 time or Constant Time or O (1) Step 7: C4 // Execute only 1 time or Constant Time or O (1) Step 8: C5 // Execute only 1 time or Constant Time or O (1) Step 9: C6 // Execute only 1 time or Constant Time or O (1) Total time T(n) can be calculated as follows, T(n) = C1 + C2 + (n -2 ) + (n -2 ) + (n -2 ) + C3 + C4 + C5 + C6 T(n) = C1 + C2 + n -2 + n -2 + n -2 + C3 + C4 + C5 + C6 T(n) = C1 + C2 + n + n + n - 6 + C3 + C4 + C5 + C6 T(n) = 3n + C1 + C2 + C3 + C4 + C5 + C6 -6 T(n) = 3n + (C1 + C2 + C3 + C4 + C5 + C6 -6) T(n) = 3n + C7 // C7 = (C1 + C2 + C3 + C4 + C5 + C6 -6) T(n) = n // Ignoring constant terms Or T(n) = O (n )
  • 1 Votes
    9 Posts
    3k Views
    zareenZ
    Solution: Java: public class MyClass { public static void main(String args[]) { System.out.println("My id is BC180401429"); System.out.println("** Language is JAVA **"); for(int i=0;i<=14;i++){ for(int j=0;j<=29;j++){ System.out.print("Outer:"+i+"Inner:"+j); } } } } [image: 8P6CdT9.png] C#: using System; class Program { static void Main() { Console.WriteLine("My id is BC180401429"); Console.WriteLine("** Language is C# **"); for(int i=0;i<=14;i++){ for(int j=0;j<=29;j++){ Console.Write("Outer:"+i+"Inner:"+j); } } } } [image: Vf2OntD.png] C++: #include <iostream> using namespace std; int main() { cout<< "My id is BC180401429 \n"; cout<< "** Language is C++ ** \n"; for(int i=0;i<=14;i++){ for(int j=0;j<=29;j++){ cout<< "Outer:"<<i<<"Inner:"<<j; } } } [image: vWPXez6.png]
  • 1 Votes
    10 Posts
    3k Views
    mehwishM
    Yes got it Thank you @zareen [image: ITjWMvn.png]
  • 0 Votes
    3 Posts
    1k Views
    zareenZ
    @mehwish said in CRW101 Assignmnet 1 Solution and Discussion: Please solution idea day do koye… Product: Coca Cola Tagline: Open Happiness. Jingle: “I’d like to teach the world to sing in perfect harmony. I’d like to buy the world a Coke and keep it company.” Chose you own company name and fill all these requirement as assignment mentioned.
  • 0 Votes
    2 Posts
    999 Views
    cyberianC
    Q1. Solution Requirement Most suitable topology No of links required 1 Mesh Topology 78 2 star Topology 13 3 Bus Topology 12 4 Ring Topology 13
  • 0 Votes
    1 Posts
    655 Views
    No one has replied
  • 0 Votes
    1 Posts
    602 Views
    No one has replied
Reputation Earning
How to Build a $1,000/Month World CUP LIVE Matches Live Cricket Streaming
Ads
File Sharing
Stats

0

Online

3.0k

Users

2.8k

Topics

8.5k

Posts
Popular Tags
Online User
| |